home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 1 / The 640 Meg Shareware Studio CD-ROM Volume I (Data Express)(1992).ISO / driver / macpab1.dsk / MACPA1.ZIP / AUDIODD / SOURCE / AUDIODD.H next >
C/C++ Source or Header  |  1992-06-30  |  21KB  |  462 lines

  1.  
  2. #define CURRENT_VERSION  0x01020000
  3.  
  4. #if IS_OS2
  5. #define INCL_DOSSEMAPHORES
  6. #define INCL_DOSPROCESS
  7. #endif
  8.  
  9. /* IOCtl request id definitions */
  10. #define AUDIO_INIT      0
  11. #define AUDIO_STATUS    1
  12. #define AUDIO_CONTROL   2
  13. #define AUDIO_BUFFER    3
  14. #define AUDIO_LOAD      4
  15. #define AUDIO_WAIT      5
  16. #define AUDIO_HPI       6
  17. #define AUDIO_UPDATE    7
  18. #define AUDIO_DIAG8_READ 12
  19. #define AUDIO_DIAG8_WRITE 13
  20. #define AUDIO_DIAG16_READ 14
  21. #define AUDIO_DIAG16_WRITE 15
  22.  
  23. /*********************************/
  24. /* AUDIO_INIT definitions        */
  25. /*********************************/
  26.  
  27. /* This defines the O/S specific audio_init.loadpath length                */
  28. #define  LOAD_PATH   260                  /* HPFS len of 260               */
  29.  
  30. struct audio_init {
  31.                                           /* Verify Access call            */
  32.    long  srate;                           /* Sampling rate in HZ           */
  33.    long  bits_per_sample;                 /* # of bits per sample          */
  34.    long  bsize;                           /* block size (in bytes)         */
  35.    short mode;                            /* Audio mode                    */
  36.    short channels;                        /* number of channels (2=stereo) */
  37.    long  position_resolution;             /* Resolution of position info   */
  38.    char  loadpath[LOAD_PATH];             /* path of DSP code to load      */
  39.    unsigned long flags;                   /*                               */
  40.    unsigned long operation;               /* operation to be performed     */
  41.    short rc;                              /* return code for operation     */
  42.    short slot_number;                     /* slot number of adapter        */
  43.    short device_id;                       /* adapter type id number        */
  44.    void  far *reserved;                   /* reserved field                */
  45.    long  version_level;                   /* Version Level                 */
  46. };
  47. typedef struct audio_init far *AIP;
  48.  
  49. /* audio_init.mode definitions                                             */
  50. #define  ADPCM    1                       /* AVC type ADPCM                */
  51. #define  PCM      2                       /* Pulse Coded Modulation        */
  52. #define  MU_LAW   3                       /* mu-law                        */
  53. #define  MIDI     4                       /* MIDI data                     */
  54. #define  A_LAW    5                       /* a-law                         */
  55. #define  SOURCE_MIX 6                     /* External audio source         */
  56. #define  SPV2     7                       /* Speech Viewer/2               */
  57. #define  ADPCMXA  8                       /* XA CD ROM                     */
  58. #define  DSSM     9                       /* DigiSpeech std mode           */
  59. #define  DSMM     10                      /* DigiSpeech movie mode         */
  60. #define  CVSD     11                      /* CVSD                          */
  61. #define  SPV2BCPCM      25                /* Speech Viewer/2               */
  62. #define  SPV2PCM        26
  63. #define  SPV2NONE       27
  64. #define  CLAIM_HDWR 32000                 /* Serialize access to hardware  */
  65. #define  IDLE       999                   /* De_Initialize the Track       */
  66.  
  67. /* audio_init.flags definitions                                            */
  68. #define  FIXED             0x00000001l    /* Fixed length data             */
  69. #define  LEFT_ALIGNED      0x00000002l    /* Left align bits on byte bndry */
  70. #define  RIGHT_ALIGNED     0x00000004l    /* Right align bits on byte bndry*/
  71. #define  TWOS_COMPLEMENT   0x00000008l    /* 2's complement data           */
  72. #define  SIGNED            0x00000010l    /* Signed data                   */
  73. #define  BIG_ENDIAN        0x00000020l    /* MSB's first (motorola format) */
  74. #define  TIMER_USED        0x00020000l    /* System Timer is being used    */
  75. #define  FOREGROUND        0x00040000l    /* Foreground operation only     */
  76. #define  INPUT_GAIN        0x00080000l    /* Input gain is supported       */
  77. #define  PITCH             0x00100000l    /* Pitch control is supported    */
  78. #define  INPUT             0x00200000l    /* Input select is supported     */
  79. #define  OUTPUT            0x00400000l    /* Output select is supported    */
  80. #define  MONITOR           0x00800000l    /* Monitor is supported          */
  81. #define  VOLUME            0x01000000l    /* Volume control is supported   */
  82. #define  VOLUME_DELAY      0x02000000l    /* Volume delay is supported     */
  83. #define  BALANCE           0x04000000l    /* Balance control is supported  */
  84. #define  BALANCE_DELAY     0x08000000l    /* Balance delay is supported    */
  85. #define  TREBLE            0x10000000l    /* Treble control is supported   */
  86. #define  BASS              0x20000000l    /* Bass control supported        */
  87. #define  BESTFIT_PROVIDED  0x40000000l    /* bestfit returned              */
  88. #define  LOAD_CODE         0x80000000l    /* DSP load needed               */
  89.  
  90. /* audio_init.operation definitions                                        */
  91. #define  PLAY                  0x80000001
  92. #define  RECORD                0x80000002
  93. #define  PLAY_AND_RECORD       0x80000003
  94. #define  ANALYSIS              0x80000006 /* Speech Viewer/2               */
  95. #define  DISTANCE              0x80000007 /* Speech Viewer/2               */
  96. #define  MIGRATION             0x80000008 /* Speech Viewer/2               */
  97.  
  98.  
  99. /* This define is used in integer fields to be ignored                     */
  100. #define  AUDIO_IGNORE   -1                /* Ignore this field             */
  101.  
  102. /* audio_init.device_id definitions                                        */
  103. #define  MINIDD         0                 /* Mini DD for serialization only*/
  104. #define  ACPA           1                 /* IBM ACPA card                 */
  105. #define  MACPA          2                 /* IBM M-ACPA card               */
  106. #define  MPU_401        3                 /* Roland MPU-401 or equivalent  */
  107. #define  SOUND_BLASTER  4                 /* Sound Blaster                 */
  108. #define  IMF            5                 /* IBM Music Feature             */
  109. #define  PS1            6                 /* IBM Personal System/1 Audio   */
  110. #define  DIGISPEECH     9                 /* DigiSpeech DS201              */
  111.  
  112. /****************************/
  113. /* AUDIO_CHANGE definitions */
  114. /****************************/
  115. struct devid {
  116.    unsigned long devtype;
  117.    unsigned long devnum;
  118. }; /* end struct devid */
  119.  
  120. struct midi_mode_info_struct {
  121.    short tempo;
  122.    short cpqn;
  123.    short midi_switches;
  124.    short reserved[5];
  125. }; /* end struct devid */
  126.  
  127. struct audio_change {
  128.    void far *dev_info;                 /* Pointer to dev dep info        */
  129.    long   input;                       /* Input selection                */
  130.    long   output;                      /* Output selection               */
  131.    long   monitor;                     /* Monitor select                 */
  132.    long   volume;                      /* Volume control setting         */
  133.    long   volume_delay;                /* # msec's over change occurs    */
  134.    long   balance;                     /* Balance control setting        */
  135.    long   balance_delay;               /* # msec's which change occurs   */
  136.    long   treble;                      /* Treble tone control setting    */
  137.    long   bass;                        /* Bass tone control setting      */
  138.    long   pitch;                       /* Pitch control setting          */
  139.    struct devid input_list[8];         /* Array of up to 8 input devices */
  140.    struct devid output_list[8];        /* Array of up to 8 output devices*/
  141.    struct devid far *more_inputs;      /* Ptr to array of add'tl inputs  */
  142.    struct devid far *more_outputs;     /* Ptr to array of add'tl outputs */
  143.    long   input_gain;                  /* Input Gain                     */
  144.    void   far *mode_info;              /* Ptr to mode specific info      */
  145. };
  146.  
  147. /* any field in the audio_change structure that should not be changed */
  148. #define  AUDIO_IGNORE   -1
  149.  
  150. /* audio_change.input definitions (for ACPA device) */
  151. #define  HIGH_GAIN_MIC  0
  152. #define  LINE_1         1
  153. #define  LINE2          2
  154. #define  LINES_1AND2    3
  155. #define  LOW_GAIN_MIC   4
  156. #define  ALL_LINES      0xffff
  157. #define  INPUTS_LISTED 0x5555
  158.  
  159. /* audio_change.output definitions (for ACPA device) */
  160. #define  EXTERNAL_SPEAKER  1     /* n/a */
  161. #define  INTERNAL_SPEAKER  2
  162. #define  OUTPUT_1          4     /* n/a */
  163. #define  OUTPUTS_LISTED  0x5555
  164.  
  165. /* audio_status.monitor definitions (for ACPA device) */
  166. #define  MONITOR_OFF          0
  167. #define  MONITOR_UNCOMPRESSED 1
  168. #define  MONITOR_COMPRESSED   2
  169.  
  170. /* Devid.devtype definitions  */
  171.  
  172. /* Input devices              */
  173. #define  NULL_INPUT           0
  174. #define  STEREO_LINE_INPUT    1
  175. #define  LEFT_LINE_INPUT      2
  176. #define  RIGHT_LINE_INPUT     3
  177. #define  MIC_INPUT            4
  178. #define  BOOSTED_MIC_INPUT    5
  179. #define  PHONE_LINE_INPUT     6
  180. #define  HANDSET_INPUT        7
  181. #define  SYNTH_INPUT          8
  182. #define  DIGITAL_PHONE_LINE_INPUT 9
  183. #define  DIGITAL_HANDSET_INPUT    10
  184. #define  MIDI_IN_PORT         11
  185. #define  LOOPBACK             12
  186. #define  DEFAULT_INPUT        0xffffffff
  187.  
  188. /* Output devices             */
  189. #define  NULL_OUTPUT          0
  190. #define  STEREO_LINE_OUTPUT   1
  191. #define  LEFT_LINE_OUTPUT     2
  192. #define  RIGHT_LINE_OUTPUT    3
  193. #define  SPEAKER_OUTPUT       4
  194. #define  HEADSET_OUTPUT       5
  195. #define  PHONE_LINE_OUTPUT    6
  196. #define  HANDSET_OUTPUT       7
  197. #define  MIDI_OUTPUT          8
  198. #define  DIGITAL_PHONE_LINE_OUTPUT 9
  199. #define  DIGITAL_HANDSET_OUTPUT    10
  200. #define  MIDI_OUT_PORT        11
  201. #define  DEFAULT_OUTPUT       0xffffffff
  202.  
  203. /* Defined values for devnum */
  204. #define  DEFAULT_DEVICE       0
  205. #define  DEVICE_1             1
  206. #define  DEVICE_2             2
  207.  
  208. /* midi_switches definitions */
  209. #define MIDI_THRU_OUT  1       /* Configure MIDI_Thru connector as MIDI_Out  */
  210. #define MIDI_THRU_THRU 1       /* Configure MIDI_Thru connector as MIDI_Thru */
  211.  
  212. /****************************/
  213. /* AUDIO_STATUS definitions */
  214. /****************************/
  215. struct audio_status {
  216.    long  srate;                           /* sampling rate in Hz             */
  217.    long  bits_per_sample;                 /* number of bits per sample       */
  218.    long  bsize;                           /* block size for this rate (bytes)*/
  219.    short mode;                            /* ADPCM, PCM, MIDI, etc.          */
  220.    short channels;                        /* number of channels (2=stereo)   */
  221.    unsigned long flags;                   /* variable, fixed, etc.           */
  222.    unsigned long operation;               /* desired operation (play, etc)   */
  223.    struct audio_change change;            /* volume, balance, etc.           */
  224. };
  225. typedef struct audio_status far *ASP;
  226.  
  227. /* audio_status.operation definitions */
  228. #define  STOPPED                 0
  229. #define  PLAYING                 1
  230. #define  RECORDING               2
  231. #define  PLAYING_AND_RECORDING   3
  232. #define  UNINITIALIZED           0xffffffff
  233.  
  234. /*****************************/
  235. /* AUDIO_CONTROL definitions */
  236. /*****************************/
  237. struct audio_control {
  238.    unsigned short ioctl_request; /* desired IOCtl request to be done        */
  239.    void     far *request_info;   /* request specific information            */
  240.    unsigned long position;       /* # of units before request should be done*/
  241.    short    return_code;         /* error code                              */
  242. };
  243. typedef struct audio_control far *ACP;
  244.  
  245. /* audio_control.ioctl_request ids */
  246. #define AUDIO_CHANGE    0
  247. #define AUDIO_START     1
  248. #define AUDIO_STOP      2
  249. #define AUDIO_PAUSE     3
  250. #define AUDIO_RESUME    4
  251. #define AUDIO_NOTIFY    5        /* reserved */
  252.  
  253.  
  254. /****************************/
  255. /* AUDIO_BUFFER definitions */
  256. /****************************/
  257. struct audio_buffer {
  258.    unsigned long flags;          /* Indicates an error condition occurred  */
  259.    unsigned long read_buf_size;  /* Amount of data in read queue (bytes)   */
  260.    unsigned long write_buf_size; /* Amount of data in write queue (bytes)  */
  261.    unsigned long read_buf_time;  /* Amount of data in read queue (msecs)   */
  262.    unsigned long write_buf_time; /* Amount of data in write queue (msecs)  */
  263.    unsigned long read_buf_max;   /* max number of bytes ever in read q     */
  264.    unsigned long write_buf_max;  /* max number of bytes ever in write q    */
  265.    unsigned long position;       /* time count since beginning of operation*/
  266.    unsigned long position_type;  /* specifies the type of position units   */
  267.    long  read_buf_cap;           /* capacity of read queue (-1 if var)     */
  268.    long  write_buf_cap;          /* capacity of write queue (-1 if var)    */
  269.    long  request_buf_cap;        /* max number of requests that can be q'd */
  270. };
  271. typedef struct audio_buffer far *ABP;
  272.  
  273. /* These are the possible error states that can be flagged in 'flags' */
  274. #define  AUDIO_UNDERRUN 1
  275. #define  AUDIO_OVERRUN  2
  276.  
  277. /* These are the currently defined position_type values */
  278. #define  POS_MSECS      0              /* Milliseconds                     */
  279. #define  MIDI_CLOCKS    1              /* Midi Timing Clocks               */
  280. #define  POS_BYTES      2              /* Position data is in bytes        */
  281. #define  SMPTE_24       24             /* SMPTE 24 frames/second           */
  282. #define  SMPTE_25       25             /* SMPTE 25 frames/second           */
  283. #define  SMPTE_30DF     29             /* SMPTE 30 frames/second drop frame*/
  284. #define  SMPTE_30       30             /* SMPTE 30 frames/second non-drop  */
  285.  
  286.  
  287. /*********************************/
  288. /* AUDIO_LOAD definitions        */
  289. /*********************************/
  290. struct audio_load {
  291.    char  far *buffer;
  292.    unsigned long size;
  293.    unsigned long flags;
  294. };
  295. typedef struct audio_load far *ALP;
  296. #define  LOAD_START  1
  297. #define  LOAD_END    2
  298. #define  LOAD_32BIT  0x10                 /* *buffer is 0:32 pointer       */
  299.  
  300. /*******************************/
  301. /* Diagnostic definitions      */
  302. /*******************************/
  303. struct diag_regs8 {
  304.    unsigned char offset;
  305.    unsigned char data;
  306. };
  307. typedef struct diag_regs8 far *DR8;
  308.  
  309. struct diag_regs16 {
  310.    unsigned short offset;
  311.    unsigned short data;
  312. };
  313. typedef struct diag_regs16 far *DR16;
  314.  
  315. /*******************************/
  316. /* Track Information Structure */
  317. /*******************************/
  318. struct track_info {
  319.    unsigned short master_volume;
  320.    unsigned short dither_percent;   /* Percent of a bit dither during record  */
  321.    unsigned short master_volume_delay;
  322.    unsigned short master_balance;
  323.    unsigned short master_balance_delay;
  324. };
  325.  
  326. /*******************/
  327. /* IOBUF Structure */
  328. /*******************/
  329.  
  330. struct addrs_array {           /* array of ptrs describing buffers    */
  331.    unsigned long length;       /* note - user may pass in >1 buff     */
  332.    char far *Virt;             /* User's virtual address              */
  333.    char far *Phys;             /* Physical address                    */
  334.    long lock_handle;           /* Lock Handle                         */
  335. } ;
  336.  
  337. struct iobuf
  338. {
  339.    unsigned long size;            /* size in bytes of the data buffer    */
  340.    char far *head;                /* head pointer (data added here)      */
  341.    char far *tail;                /* tail pointer (data removed here)    */
  342.    unsigned short head_segnum;
  343.    unsigned short tail_segnum;
  344.    unsigned long count;           /* # of data bytes currently queued    */
  345.    unsigned long position;        /* Position counter                    */
  346.    long delay;                    /* # pos units until next i/o          */
  347.    unsigned short runflags;       /* start/stop/pause control bits       */
  348.    char far *pIobufPhys;          /* physical address of this structure  */
  349.    long lock_handle;              /* Handle for UnLock call of iobuf     */
  350.    unsigned short num_buffers;    /* Number of buffers passed by app.    */
  351.    struct addrs {                 /* array of ptrs describing buffers    */
  352.       unsigned long length;       /* note - user may pass in >1 buff     */
  353.       char far *Virt;             /* User's virtual address              */
  354.       char far *Phys;             /* Physical address                    */
  355.       long lock_handle;           /* Lock Handle                         */
  356.    } buf[1];
  357. };
  358. typedef struct iobuf far *IOB;
  359. /* iobuf.runflags equates  */
  360. #define  STARTED        1
  361. #define  PAUSED         2
  362. #define  WAS_RUNNING    4           /* Flag to see if was running last int */
  363. #define  IOB_OVERRUN    0x20        /* Overrun has occurred.               */
  364. #define  IOB_UNDERRUN   0x40        /* Underrun has occurred.              */
  365. #define  CHAIN_BUFFERS  0x80        /* Reserved - must be 0!               */
  366. #define  CBDATA         0x0100      /* callback if any data                */
  367. #define  CBBLOCK        0x0200      /* callback if any blocks              */
  368. #define  CBIOBUF        0x0400      /* callback if changed buffers         */
  369. #define  CBERROR        0x0800      /* callback if error detected          */
  370. #define  CBUNDERRUN     0x1000      /* callback if underrun/overrun occurs */
  371. #define  PADIT          0x4000      /* Pad any partial blocks with silence */
  372. #define  IOBUF_LOCK     0x8000      /* IOBUF being updated by appl         */
  373.  
  374.  
  375. /***********************/
  376. /* AUDIO_HPI Structure */
  377. /***********************/
  378. struct audio_hpi
  379. {
  380.   void (far * ep)();            /* pointer to direct call entry point       */
  381.   void (far * cb)();            /* pointer to callback routine/semaphore    */
  382.   struct iobuf far *newxbuf;    /* pointer to xmit iobuf structure          */
  383.   struct iobuf far *newrbuf;    /* pointer to receive iobuf structure       */
  384.   unsigned short flags;         /* reserved.                                */
  385. };
  386. typedef struct audio_hpi far *HPI;
  387.  
  388. /* audio_hpi.flags definitions */
  389. #define  CBXMIT   1
  390. #define  CBREC    2
  391. #define  CBTIMER  4
  392.  
  393. /*  Direct call interface definitions */
  394. /*  void  (far *iobuf.ep)(int funcid, void far *data, int len);    */
  395. /* Definitions for funcid */
  396. #define EP_OPEN      0
  397. #define EP_CLOSE     1
  398. #define EP_READ      2
  399. #define EP_WRITE     3
  400. #define EP_INIT      4
  401. #define EP_STATUS    5
  402. #define EP_CONTROL   6
  403. #define EP_BUFFER    7
  404. #define EP_LOAD      8
  405. #define EP_WAIT      9
  406. #define EP_HPI       10
  407. #define EP_UPDATE    11
  408.  
  409. /**************************/
  410. /* AUDIO_UPDATE Structure */
  411. /**************************/
  412. struct audio_update
  413. {
  414.   char iobuf_type;              /* 0 - XMITIO, 1 - RECIO to be updated      */
  415.   char far *buffer_address;     /* address to buffer to be added to array   */
  416.   unsigned long buffer_length;  /* length of buffer to be added             */
  417.   unsigned short rc;            /* return code                              */
  418.   void far *reserved;           /* future use                               */
  419. };
  420. typedef struct audio_update far *UPDATE;
  421.  
  422. /* audio_update.iobuf_type definitions                                      */
  423. #define  XMIT_IOBUF 0
  424. #define  REC_IOBUF  1
  425.  
  426. /**************************************************/
  427. /* Speech Viewer/2 Device Specific Data Structure */
  428. /**************************************************/
  429. struct spv2_mode_info_struct
  430. {
  431.   unsigned short pitch;
  432.   unsigned short num_LPC_coeff;
  433.   unsigned short rate_of_LPC;
  434.   unsigned short hamming_width;
  435.   unsigned short ret_signal;
  436.   unsigned short slow_down;
  437. };
  438.  
  439. /* audio_init.rc definitions                                               */
  440. #define  NO_PLAY              1           /* Cannot play                   */
  441. #define  NO_RECORD            2           /* Cannot record                 */
  442. #define  NO_PLAY_AND_RECORD   3           /* Cannot both play and record   */
  443. #define  INVALID_REQUEST      4           /* request was invalid           */
  444. #define  CONFLICT             5           /* Conflicting info in request   */
  445. #define  OVERLOADED           6           /* Out of DSP MIPS or memory     */
  446. #define  DOWNLEVEL_DD         7           /* DD is down level from appl.   */
  447.  
  448. /* audio_control.return_code */
  449. #define  AC_UNINITED          1       /* Device must be init'ed or loaded first    */
  450. #define  FULL_QUEUE           2       /* Maximum # requests exceeded        */
  451. #define  AC_UNPAUSED          3       /* Resume issued, but dev not paused  */
  452. #define  INVALID_REQUEST      4       /* bad audio_control.ioctl_request    */
  453. #define  AC_UNSTARTED         5       /* Device must be started first       */
  454. #define  INVALID_INPUT_LIST   7       /* invalid change.input_list entry    */
  455. #define  INVALID_OUTPUT_LIST  8       /* invalid change.output_list entry   */
  456.  
  457. /* audio_update.rc definitions                                              */
  458. #define  MAX_NUM_BUFFERS_REACHED 9
  459. #define  UPDATE_GENERAL_FAILURE  10
  460. #define  INVALID_BUFFER_LENGTH   11
  461.  
  462.